<script setup>
import { RouterView } from 'vue-router'
import FactoryDashboard from './components/FactoryDashboard.vue'
import { ref } from 'vue'

const showDashboard = ref(false)
</script>

<template>
  <div class="factory-visualization">
    <nav class="main-nav">
      <div class="nav-container">
        <div class="nav-logo">
          <img src="./assets/logo/logo.png" alt="Logo" class="logo-img">
          <span class="logo-text">智造云枢可视化平台</span>
        </div>
        <div class="nav-menu">
          <div 
            class="nav-item" 
            :class="{ active: !showDashboard }"
            @click="showDashboard = false"
          >
            <i class="el-icon-menu"></i>
            <span>系统功能</span>
          </div>
          <div 
            class="nav-item" 
            :class="{ active: showDashboard }"
            @click="showDashboard = true"
          >
            <i class="el-icon-data-board"></i>
            <span>工厂总览</span>
          </div>
        </div>
      </div>
    </nav>
    
    <div class="content-container">
      <FactoryDashboard v-if="showDashboard" />
      <RouterView v-else class="router-view" />
    </div>
  </div>
</template>

<style>
body {
  margin: 0;
  padding: 0;
  font-family: 'Microsoft YaHei', Arial, sans-serif;
  background-color: #001529;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 100%;
  background-image: url('./assets/images/bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.factory-visualization {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-nav {
  width: 100%;
  height: 60px;
  background: rgba(0, 21, 41, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(41, 182, 255, 0.3);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 32px;
  width: auto;
}

.logo-text {
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  background: linear-gradient(90deg, #29b6ff, #00eaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  gap: 20px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: #fff;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.nav-item:hover {
  background: rgba(41, 182, 255, 0.1);
}

.nav-item.active {
  background: rgba(41, 182, 255, 0.2);
  border: 1px solid #29b6ff;
}

.nav-item i {
  font-size: 18px;
}

.content-container {
  margin-top: 60px;
  flex: 1;
}

/* 图表通用样式 */
.echarts-tooltip {
  background-color: rgba(0, 21, 41, 0.8) !important;
  border: 1px solid #29b6ff !important;
  color: #fff !important;
  border-radius: 4px !important;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

::-webkit-scrollbar-track {
  display: none;
}

::-webkit-scrollbar-thumb {
  display: none;
}

::-webkit-scrollbar-thumb:hover {
  display: none;
}

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
</style>
